package com.wish.biz.dp.staffinfomanage.controller;

import org.apache.ibatis.mapping.Environment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
 
import java.util.Arrays;
 
@Component
public class BeanNamePrinter implements ApplicationContextAware {
 
    private ApplicationContext applicationContext;
 
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
        printBeanNames();
    }
 
    private void printBeanNames() {
        String[] beanNames = applicationContext.getBeanDefinitionNames();
        System.out.println("All bean names: " + Arrays.toString(beanNames));
    }
	
	 @Autowired
    private Environment env;
 
    public void checkPort() {  
//        String port = env.getProperty("server.port");
//        System.out.println("Server is running on port: " + port);
    }  
}